home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4982 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 62 6c | 61 63 6b 2e 77 65 65 67 |Path: bl|ack.weeg|
|00000010| 2e 75 69 6f 77 61 2e 65 | 64 75 21 72 6f 62 69 6e |.uiowa.e|du!robin|
|00000020| 73 6f 6e 0a 46 72 6f 6d | 3a 20 54 68 65 20 41 6d |son.From|: The Am|
|00000030| 6f 72 70 68 6f 75 73 20 | 4d 61 73 73 20 3c 72 6f |orphous |Mass <ro|
|00000040| 62 69 6e 73 6f 6e 40 62 | 6c 75 65 2e 77 65 65 67 |binson@b|lue.weeg|
|00000050| 2e 75 69 6f 77 61 2e 65 | 64 75 3e 0a 4e 65 77 73 |.uiowa.e|du>.News|
|00000060| 67 72 6f 75 70 73 3a 20 | 63 6f 6d 70 2e 6c 61 6e |groups: |comp.lan|
|00000070| 67 2e 63 0a 53 75 62 6a | 65 63 74 3a 20 52 65 3a |g.c.Subj|ect: Re:|
|00000080| 20 61 74 6f 66 2f 61 74 | 6f 69 0a 44 61 74 65 3a | atof/at|oi.Date:|
|00000090| 20 53 61 74 2c 20 31 30 | 20 46 65 62 20 31 39 39 | Sat, 10| Feb 199|
|000000a0| 36 20 31 39 3a 33 35 3a | 32 39 20 2d 30 36 30 30 |6 19:35:|29 -0600|
|000000b0| 0a 4f 72 67 61 6e 69 7a | 61 74 69 6f 6e 3a 20 55 |.Organiz|ation: U|
|000000c0| 6e 69 76 65 72 73 69 74 | 79 20 6f 66 20 49 6f 77 |niversit|y of Iow|
|000000d0| 61 2c 20 49 6f 77 61 20 | 43 69 74 79 2c 20 49 41 |a, Iowa |City, IA|
|000000e0| 2c 20 55 53 41 0a 44 69 | 73 74 72 69 62 75 74 69 |, USA.Di|stributi|
|000000f0| 6f 6e 3a 20 77 6f 72 6c | 64 0a 4d 65 73 73 61 67 |on: worl|d.Messag|
|00000100| 65 2d 49 44 3a 20 3c 50 | 69 6e 65 2e 41 33 32 2e |e-ID: <P|ine.A32.|
|00000110| 33 2e 39 31 2e 39 36 30 | 32 31 30 31 39 32 33 30 |3.91.960|21019230|
|00000120| 39 2e 34 35 39 36 39 43 | 2d 31 30 30 30 30 30 40 |9.45969C|-100000@|
|00000130| 62 6c 61 63 6b 2e 77 65 | 65 67 2e 75 69 6f 77 61 |black.we|eg.uiowa|
|00000140| 2e 65 64 75 3e 0a 52 65 | 66 65 72 65 6e 63 65 73 |.edu>.Re|ferences|
|00000150| 3a 20 3c 34 66 69 68 70 | 70 24 6a 35 71 40 6e 6e |: <4fihp|p$j5q@nn|
|00000160| 74 70 2e 6e 6f 76 69 61 | 2e 6e 65 74 3e 0a 4e 4e |tp.novia|.net>.NN|
|00000170| 54 50 2d 50 6f 73 74 69 | 6e 67 2d 48 6f 73 74 3a |TP-Posti|ng-Host:|
|00000180| 20 62 6c 61 63 6b 2e 77 | 65 65 67 2e 75 69 6f 77 | black.w|eeg.uiow|
|00000190| 61 2e 65 64 75 0a 4d 69 | 6d 65 2d 56 65 72 73 69 |a.edu.Mi|me-Versi|
|000001a0| 6f 6e 3a 20 31 2e 30 0a | 43 6f 6e 74 65 6e 74 2d |on: 1.0.|Content-|
|000001b0| 54 79 70 65 3a 20 54 45 | 58 54 2f 50 4c 41 49 4e |Type: TE|XT/PLAIN|
|000001c0| 3b 20 63 68 61 72 73 65 | 74 3d 55 53 2d 41 53 43 |; charse|t=US-ASC|
|000001d0| 49 49 0a 58 2d 53 65 6e | 64 65 72 3a 20 72 6f 62 |II.X-Sen|der: rob|
|000001e0| 69 6e 73 6f 6e 40 62 6c | 61 63 6b 2e 77 65 65 67 |inson@bl|ack.weeg|
|000001f0| 2e 75 69 6f 77 61 2e 65 | 64 75 0a 49 6e 2d 52 65 |.uiowa.e|du.In-Re|
|00000200| 70 6c 79 2d 54 6f 3a 20 | 3c 34 66 69 68 70 70 24 |ply-To: |<4fihpp$|
|00000210| 6a 35 71 40 6e 6e 74 70 | 2e 6e 6f 76 69 61 2e 6e |j5q@nntp|.novia.n|
|00000220| 65 74 3e 20 0a 0a 4f 6e | 20 31 30 20 46 65 62 20 |et> ..On| 10 Feb |
|00000230| 31 39 39 36 2c 20 4e 69 | 63 61 74 74 20 77 72 6f |1996, Ni|catt wro|
|00000240| 74 65 3a 0a 0a 3e 20 0a | 3e 20 49 20 61 6d 20 61 |te:..> .|> I am a|
|00000250| 20 72 6f 6f 6b 69 65 2e | 0a 3e 20 0a 3e 20 49 20 | rookie.|.> .> I |
|00000260| 68 61 76 65 20 62 65 65 | 6e 20 74 68 72 6f 75 67 |have bee|n throug|
|00000270| 68 20 74 68 65 20 66 61 | 71 20 61 6e 64 20 74 68 |h the fa|q and th|
|00000280| 72 65 65 20 43 20 62 6f | 6f 6b 73 20 61 6e 64 20 |ree C bo|oks and |
|00000290| 63 61 6e 6e 6f 74 20 66 | 69 6e 64 20 2a 68 6f 77 |cannot f|ind *how|
|000002a0| 2a 0a 3e 20 74 6f 20 75 | 73 65 20 61 74 6f 66 2f |*.> to u|se atof/|
|000002b0| 61 74 6f 69 2e 20 20 45 | 61 63 68 20 6d 65 6e 74 |atoi. E|ach ment|
|000002c0| 69 6f 6e 73 20 74 68 65 | 6d 20 61 6e 64 20 74 68 |ions the|m and th|
|000002d0| 65 69 72 20 70 75 72 70 | 6f 73 65 2c 20 62 75 74 |eir purp|ose, but|
|000002e0| 20 6e 6f 6e 65 20 65 78 | 70 6c 61 69 6e 73 20 0a | none ex|plains .|
|000002f0| 3e 20 68 6f 77 20 74 6f | 20 75 73 65 20 74 68 65 |> how to| use the|
|00000300| 6d 2e 0a 0a 20 20 54 68 | 65 79 20 73 68 6f 75 6c |m... Th|ey shoul|
|00000310| 64 20 68 61 76 65 20 73 | 68 6f 77 6e 20 74 68 65 |d have s|hown the|
|00000320| 20 70 72 6f 74 6f 74 79 | 70 65 20 6f 66 20 61 74 | prototy|pe of at|
|00000330| 6f 66 2c 20 77 68 69 63 | 68 20 69 73 20 0a 0a 64 |of, whic|h is ..d|
|00000340| 6f 75 62 6c 65 20 61 74 | 6f 66 28 63 6f 6e 73 74 |ouble at|of(const|
|00000350| 20 63 68 61 72 20 2a 29 | 3b 0a 0a 20 20 54 68 69 | char *)|;.. Thi|
|00000360| 73 20 72 65 61 64 73 20 | 22 54 68 65 20 66 75 6e |s reads |"The fun|
|00000370| 63 74 69 6f 6e 20 61 74 | 6f 66 20 74 61 6b 65 73 |ction at|of takes|
|00000380| 20 61 73 20 61 20 70 61 | 72 61 6d 65 74 65 72 20 | as a pa|rameter |
|00000390| 61 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 63 6f 6e |a pointe|r to con|
|000003a0| 73 74 20 0a 63 68 61 72 | 20 61 6e 64 20 72 65 74 |st .char| and ret|
|000003b0| 75 72 6e 73 20 61 20 64 | 6f 75 62 6c 65 2e 22 20 |urns a d|ouble." |
|000003c0| 20 22 64 6f 75 62 6c 65 | 22 20 69 73 20 61 20 66 | "double|" is a f|
|000003d0| 6c 6f 61 74 69 6e 67 2d | 70 6f 69 6e 74 20 74 79 |loating-|point ty|
|000003e0| 70 65 2e 20 20 53 6f 20 | 74 6f 20 0a 75 73 65 20 |pe. So |to .use |
|000003f0| 61 74 6f 66 28 29 20 79 | 6f 75 20 6e 65 65 64 20 |atof() y|ou need |
|00000400| 61 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 63 68 61 |a pointe|r to cha|
|00000410| 72 20 74 68 61 74 20 70 | 6f 69 6e 74 73 20 74 6f |r that p|oints to|
|00000420| 20 74 68 65 20 73 74 72 | 69 6e 67 20 79 6f 75 20 | the str|ing you |
|00000430| 77 61 6e 74 20 0a 74 6f | 20 63 6f 6e 76 65 72 74 |want .to| convert|
|00000440| 20 28 69 74 20 64 6f 65 | 73 6e 27 74 20 68 61 76 | (it doe|sn't hav|
|00000450| 65 20 74 6f 20 62 65 20 | 61 20 63 6f 6e 73 74 20 |e to be |a const |
|00000460| 63 68 61 72 29 20 61 6e | 64 20 61 20 64 6f 75 62 |char) an|d a doub|
|00000470| 6c 65 20 74 6f 20 73 74 | 6f 72 65 20 74 68 65 20 |le to st|ore the |
|00000480| 0a 72 65 74 75 72 6e 65 | 64 20 76 61 6c 75 65 20 |.returne|d value |
|00000490| 6f 66 20 74 68 65 20 63 | 61 6c 6c 3a 0a 0a 64 6f |of the c|all:..do|
|000004a0| 75 62 6c 65 20 64 3b 0a | 63 68 61 72 20 2a 73 20 |uble d;.|char *s |
|000004b0| 3d 20 22 31 32 33 2e 34 | 35 36 22 0a 0a 64 20 3d |= "123.4|56"..d =|
|000004c0| 20 61 74 6f 66 28 73 29 | 3b 0a 0a 3e 20 49 20 77 | atof(s)|;..> I w|
|000004d0| 72 6f 74 65 20 61 20 70 | 72 6f 67 72 61 6d 20 74 |rote a p|rogram t|
|000004e0| 68 61 74 20 77 6f 72 6b | 73 20 66 69 6e 65 2e 20 |hat work|s fine. |
|000004f0| 20 48 6f 77 65 76 65 72 | 2c 20 6f 6e 65 20 6f 66 | However|, one of|
|00000500| 20 74 68 65 20 72 65 71 | 75 69 72 65 6d 65 6e 74 | the req|uirement|
|00000510| 73 0a 3e 20 69 73 20 74 | 6f 20 74 72 61 70 20 66 |s.> is t|o trap f|
|00000520| 6f 72 20 61 6c 70 68 61 | 20 63 68 61 72 61 63 74 |or alpha| charact|
|00000530| 65 72 73 2e 20 20 49 66 | 20 49 20 75 73 65 20 22 |ers. If| I use "|
|00000540| 67 65 74 73 22 2c 20 6d | 79 20 59 2f 4e 20 72 65 |gets", m|y Y/N re|
|00000550| 73 70 6f 6e 73 65 0a 3e | 20 70 72 69 6f 72 20 74 |sponse.>| prior t|
|00000560| 6f 20 74 68 65 20 6c 6f | 6f 70 20 62 65 6c 6f 77 |o the lo|op below|
|00000570| 20 66 61 6c 6c 73 20 74 | 68 72 6f 75 67 68 2e 0a | falls t|hrough..|
|00000580| 0a 20 20 49 27 6d 20 6e | 6f 74 20 73 75 72 65 20 |. I'm n|ot sure |
|00000590| 77 68 61 74 20 79 6f 75 | 20 6d 65 61 6e 2e 20 20 |what you| mean. |
|000005a0| 49 6e 20 61 6e 79 20 63 | 61 73 65 2c 20 75 73 65 |In any c|ase, use|
|000005b0| 20 66 67 65 74 73 28 29 | 20 69 6e 73 74 65 61 64 | fgets()| instead|
|000005c0| 20 6f 66 20 67 65 74 73 | 28 29 2e 20 20 0a 49 74 | of gets|(). .It|
|000005d0| 27 73 20 73 61 66 65 72 | 2e 0a 0a 3e 20 20 49 20 |'s safer|...> I |
|000005e0| 63 61 6e 20 64 65 66 69 | 6e 65 20 2a 63 61 74 63 |can defi|ne *catc|
|000005f0| 68 2a 20 61 73 20 61 20 | 63 68 61 72 0a 3e 20 61 |h* as a |char.> a|
|00000600| 6e 64 20 74 72 61 70 20 | 74 68 65 20 63 68 61 72 |nd trap |the char|
|00000610| 61 63 74 65 72 20 61 66 | 74 65 72 20 73 63 61 6e |acter af|ter scan|
|00000620| 66 20 28 65 78 3a 20 20 | 63 61 74 63 68 3d 67 65 |f (ex: |catch=ge|
|00000630| 74 63 68 61 72 28 29 3b | 20 20 29 20 62 75 74 20 |tchar();| ) but |
|00000640| 49 20 68 61 76 65 0a 3e | 20 6e 6f 74 20 66 69 67 |I have.>| not fig|
|00000650| 75 72 65 64 20 68 6f 77 | 20 74 6f 20 75 73 65 20 |ured how| to use |
|00000660| 74 68 61 74 20 74 6f 20 | 6d 79 20 61 64 76 61 6e |that to |my advan|
|00000670| 74 61 67 65 20 74 6f 20 | 62 72 65 61 6b 20 74 68 |tage to |break th|
|00000680| 65 20 6c 6f 6f 70 2c 20 | 72 65 61 73 6b 20 66 6f |e loop, |reask fo|
|00000690| 72 0a 3e 20 74 68 65 20 | 63 6f 72 72 65 63 74 20 |r.> the |correct |
|000006a0| 76 61 6c 75 65 20 74 6f | 20 62 65 20 65 6e 74 65 |value to| be ente|
|000006b0| 72 65 64 2c 20 61 6e 64 | 20 72 65 73 74 61 72 74 |red, and| restart|
|000006c0| 20 74 68 65 20 6c 6f 6f | 70 20 61 74 20 74 68 61 | the loo|p at tha|
|000006d0| 74 20 70 6f 69 6e 74 2e | 20 20 0a 0a 20 20 44 6f |t point.| .. Do|
|000006e0| 6e 27 74 20 75 73 65 20 | 73 63 61 6e 66 28 29 2e |n't use |scanf().|
|000006f0| 20 20 52 65 61 64 20 74 | 68 65 20 75 73 65 72 27 | Read t|he user'|
|00000700| 73 20 69 6e 70 75 74 20 | 69 6e 20 77 69 74 68 20 |s input |in with |
|00000710| 61 20 63 61 6c 6c 20 74 | 6f 20 66 67 65 74 73 28 |a call t|o fgets(|
|00000720| 29 20 0a 5f 77 68 69 6c | 65 5f 20 28 68 69 6e 74 |) ._whil|e_ (hint|
|00000730| 29 20 79 6f 75 20 64 65 | 74 65 63 74 20 61 6e 20 |) you de|tect an |
|00000740| 61 6c 70 68 61 20 63 68 | 61 72 61 63 74 65 72 20 |alpha ch|aracter |
|00000750| 69 6e 20 74 68 65 20 69 | 6e 70 75 74 20 73 74 72 |in the i|nput str|
|00000760| 69 6e 67 20 28 62 79 2c | 20 66 6f 72 20 0a 65 78 |ing (by,| for .ex|
|00000770| 61 6d 70 6c 65 2c 20 63 | 68 65 63 6b 69 6e 67 20 |ample, c|hecking |
|00000780| 74 68 65 20 69 6e 70 75 | 74 20 73 74 72 69 6e 67 |the inpu|t string|
|00000790| 20 6f 6e 65 20 63 68 61 | 72 61 63 74 65 72 20 61 | one cha|racter a|
|000007a0| 74 20 61 20 74 69 6d 65 | 20 66 6f 72 20 61 6c 70 |t a time| for alp|
|000007b0| 68 61 20 0a 63 68 61 72 | 61 63 74 65 72 73 29 2e |ha .char|acters).|
|000007c0| 0a 0a 20 20 59 6f 75 20 | 73 68 6f 75 6c 64 20 64 |.. You |should d|
|000007d0| 6f 77 6e 6c 6f 61 64 20 | 74 68 65 20 46 41 51 20 |ownload |the FAQ |
|000007e0| 66 6f 72 20 74 68 69 73 | 20 6e 65 77 73 67 72 6f |for this| newsgro|
|000007f0| 75 70 20 28 66 74 70 20 | 72 74 66 6d 2e 6d 69 74 |up (ftp |rtfm.mit|
|00000800| 2e 65 64 75 2c 20 63 64 | 20 2f 70 75 62 2f 0a 75 |.edu, cd| /pub/.u|
|00000810| 73 65 6e 65 74 2d 62 79 | 2d 67 72 6f 75 70 2f 63 |senet-by|-group/c|
|00000820| 6f 6d 70 2e 6c 61 6e 67 | 2e 63 2f 43 2d 46 41 51 |omp.lang|.c/C-FAQ|
|00000830| 29 2e 20 20 49 74 27 73 | 20 61 20 76 65 72 79 20 |). It's| a very |
|00000840| 67 6f 6f 64 20 72 65 66 | 65 72 65 6e 63 65 2c 20 |good ref|erence, |
|00000850| 61 6e 64 20 69 74 20 0a | 61 6e 73 77 65 72 73 20 |and it .|answers |
|00000860| 73 6f 6d 65 20 6f 66 20 | 74 68 65 20 71 75 65 73 |some of |the ques|
|00000870| 74 69 6f 6e 73 20 79 6f | 75 20 68 61 76 65 20 69 |tions yo|u have i|
|00000880| 6e 20 74 68 69 73 20 70 | 6f 73 74 2e 0a 0a 2f 2a |n this p|ost.../*|
|00000890| 2a 4a 61 6d 65 73 20 52 | 6f 62 69 6e 73 6f 6e 2a |*James R|obinson*|
|000008a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000008b0| 2a 2a 2a 2a 2a 2a 20 20 | 20 20 20 20 20 20 20 20 |****** | |
|000008c0| 20 20 0a 20 20 22 49 66 | 20 61 20 66 61 74 61 6c | . "If| a fatal|
|000008d0| 20 65 72 72 6f 72 20 6f | 63 63 75 72 73 2c 20 74 | error o|ccurs, t|
|000008e0| 68 65 20 70 72 6f 67 72 | 61 6d 20 73 68 6f 75 6c |he progr|am shoul|
|000008f0| 64 20 6e 6f 74 20 62 65 | 20 61 6c 6c 6f 77 65 64 |d not be| allowed|
|00000900| 20 74 6f 20 63 6f 6e 74 | 69 6e 75 65 2e 22 0a 20 | to cont|inue.". |
|00000910| 2d 2d 20 4f 72 61 63 6c | 65 20 50 72 6f 2a 43 20 |-- Oracl|e Pro*C |
|00000920| 55 73 65 72 27 73 20 47 | 75 69 64 65 20 20 20 20 |User's G|uide |
|00000930| 20 20 20 20 20 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | ***|********|
|00000940| 2a 2a 6a 61 6d 65 73 2d | 72 6f 62 69 6e 73 6f 6e |**james-|robinson|
|00000950| 40 75 69 6f 77 61 2e 65 | 64 75 2a 2a 2f 0a |@uiowa.e|du**/. |
+--------+-------------------------+-------------------------+--------+--------+